from view.base import WordFrameBase
from qfluentwidgets import TransparentToolButton, FluentIcon, StateToolTip
from PyQt5.Qt import *


class DocAndDocxThread(QThread):
    def __init__(self, parent=None):
        super().__init__(parent)

    def run(self):
        pass

    def set_value(self):
        pass


class DocAndDocxFrame(QFrame):
    returned = pyqtSignal()

    def __init__(self, parent=None):
        super().__init__(parent)
        self.VBox = QVBoxLayout(self)
        self.VBox.setContentsMargins(10, 10, 10, 10)
        self.VBox.setSpacing(10)
        self.VBox.setAlignment(Qt.AlignTop | Qt.AlignVCenter)

        self.returnButton = TransparentToolButton()
        self.returnButton.setFixedSize(40, 40)
        self.returnButton.setIcon(FluentIcon.RETURN)
        self.returnButton.clicked.connect(self.returned.emit)

        self.docToDocx = WordFrameBase()
        self.docToDocx.setTitle('Doc转Docx')
        self.docToDocx.returnButton.close()
        self.docToDocx.contentLabel.close()
        self.docToDocx.stateToolTip.close()
        self.docToDocx.setLabelText('Doc文件夹路径：', 'Docx文件夹路径：')
        self.docToDocx.started.connect(self.docToDocxThread)

        self.docxToDoc = WordFrameBase()
        self.docxToDoc.setTitle('Docx转Doc')
        self.docxToDoc.returnButton.close()
        self.docxToDoc.contentLabel.close()
        self.docToDocx.stateToolTip.close()
        self.docxToDoc.setLabelText('Docx文件夹路径：', 'Doc文件夹路径：')
        self.docxToDoc.started.connect(self.docxToDocThread)

        self.VBox.addWidget(self.returnButton)
        self.VBox.addWidget(self.docToDocx)
        self.VBox.addWidget(self.docxToDoc)

        self.stateTool = StateToolTip('', '', self)
        self._thread = DocAndDocxThread(self)
        def started_thread():
            pass
        self._thread.started.connect()
        self._thread.finished.connect()

    def docxToDocThread(self):
        pass

    def docToDocxThread(self):
        pass


if __name__ == '__main__':
    import sys

    QApplication.setHighDpiScaleFactorRoundingPolicy(
        Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
    )
    QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
    QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
    app = QApplication(sys.argv)
    win = DocAndDocxFrame()
    win.show()
    sys.exit(app.exec_())
